package YHATM;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.List;

public class Test {
    static File people;
    static FileReader fr;
    static FileWriter fw;
    static List<Account> user;//建立储存账号信息的集合

    public static String[] str = {
            "123456788 123456 9900\n",
            "123412345 123456 12000\n",
            "001 123456 12000\n",
            "002 123456 12000\n",
    }, strs, len;

    public static void main(String args[]) throws Exception {
        user = new ArrayList<>();
        System.out.println(user.isEmpty());
        people = new File("number.txt");
        people.createNewFile();
        fw = new FileWriter("number.txt");
        for (String s : str) {
            if (s != null && !s.trim().isEmpty()) {
                fw.write(s);
            }
        }
        fw.flush();
        fw.close();
        login();
        new Login();
    }

    public static void login() {
        try {
            fr = new FileReader("number.txt");
            BufferedReader bfr = new BufferedReader(fr);
            len = new String[20];
            for (int i = 0; i < 5; i++) {
                while ((len[i] = bfr.readLine()) == "\n") {
                    break;
                }
            }
            System.out.println(len[1]);
            strs = new String[20];
            for (int i = 0; i < str.length; i++) {
                strs = len[i].split("\\s");
                Account a = new Account(strs[0], strs[1], strs[2]);
                user.add(a);
                System.out.println(user.get(i).passwd);
            }
            System.out.println(user.size());
            System.out.println(user.get(0).money);
            fr.close();
            bfr.close();
            System.out.printf(strs[0]);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}








